package com.flymobi.service;

import java.util.List;

import com.flymobi.fw.modules.CommonService;
import com.flymobi.po.ZhuantiNews;
import com.flymobi.util.QL;

public class ZhuantiNewsService extends CommonService {

	/*public List<ZhuantiNews> list(Long zhuantiId) {
		return dao.find(ZhuantiNews.class, QL.HQL.ZhuantiNews.LIST_SUB, new Object[] {zhuantiId});
	}*/
	
	public List<ZhuantiNews> list(Long zhuantiId,int startRow, int pagePerSize) {
		return dao.find(ZhuantiNews.class, QL.HQL.ZhuantiNews.LIST, new Object[] {zhuantiId},startRow,pagePerSize);
	}
	
	public List<ZhuantiNews> listByBlock(Long blockId,int startRow, int pagePerSize) {
		return dao.find(ZhuantiNews.class, QL.HQL.ZhuantiNews.LISTBYBLOCK, new Object[] {blockId},startRow,pagePerSize);
	}
	
	public ZhuantiNews find(Long zhuantiId,Long newsId) {
		return dao.findSingle(ZhuantiNews.class, QL.HQL.ZhuantiNews.FIND_NEWS, new Object[] {zhuantiId,newsId});
	}
	
	public Long getCount(Long zhuantiId) {
		return dao.getCount(QL.HQL.ZhuantiNews.GET_COUNT, new Object[] {zhuantiId});
	}

	public Long getCountByBlock(Long blockId) {
		return dao.getCount(QL.HQL.ZhuantiNews.GET_COUNT_BY_BLOCK, new Object[] {blockId});
	}
	
	public void save(ZhuantiNews ZhuantiNews) {
		dao.save(ZhuantiNews);
	}

	public ZhuantiNews load(String id) {
		return dao.load(ZhuantiNews.class, new Long(id));
	}
	
	public ZhuantiNews get(String id) {
		return dao.get(ZhuantiNews.class, new Long(id));
	}

	public void delete(String id) {
		dao.delete(this.get(id));
	}
	
	public void delete(Long zhuantiid,Long newsid) {
		dao.executeByHQL("delete from ZhuantiNews m where m.zhuantiId=? and m.newsId=?", new Object[] {zhuantiid,newsid});
	}
	
}
